Server Watch Plugin SDK Date: 6 Feb 2004
Release: 1.0
Main Page | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

SWPluginServerStruct Struct Reference

#include <SWPluginServerStruct.h>

List of all members.


Detailed Description

The SWPluginServerStruct structure is used to identify a server and maintain the data associated with that server.


Public Member Functions

Constructor
 SWPluginServerStruct (const SWHandle &handle, const wchar_t *regBase)

Public Attributes

Server Watch Defined Variables
Server Watch will create all of the following classes and variables that are related to the server.

const SWHandle swhHandle
 The server identifier.
ISWServerDatapServerData
 The class that maintains the standard runtime data associated with the server.
ISWServerSettingspSettings
 The class that maintains the standard server settings as set by the end user.
const std::wstring strRegistryBase
 The string that identifies where the plugin can store information in the registry that is associated with the server.
Plugin Defined Variables
The plugin writer may and set the following variables related to the server. Otherwise they will be NULL;

void * pCustomData
 This variable is designed to give plugin writers a place to store plugin specific server information.


Constructor & Destructor Documentation

SWPluginServerStruct::SWPluginServerStruct const SWHandle handle,
const wchar_t *  regBase
[inline]
 

Default Constructor. Do not create one of these in the plugin.


Member Data Documentation

const SWHandle SWPluginServerStruct::swhHandle
 

The server identifier.

This handle identifies the server in a globally unique manner. This allows servers to be passed between computers without causing confusion. Use this handle if you need to identify the specific server associated with the SWPluginServerStruct.

ISWServerData* SWPluginServerStruct::pServerData
 

The class that maintains the standard runtime data associated with the server.

The runtime data is any data that is gathered about the current state of the server. You should set this information during Server Watch's call to the Ping() function.

ISWServerSettings* SWPluginServerStruct::pSettings
 

The class that maintains the standard server settings as set by the end user.

const std::wstring SWPluginServerStruct::strRegistryBase
 

The string that identifies where the plugin can store information in the registry that is associated with the server.

The ISWServerSettings class will maintain its own settings in the registry, however, if the plugin needs to save it's own settings, it should use the DFRegTool and pass this string into the DFRegTool::Open() function. For Example:

     #include <DFRegTool.h>

     DFRegTool reg;
     reg.OpenKey(m_pCurrentServer->strRegistryBase);

If you do not follow this rule, Server Watch cannot guaruntee that your settings will be maintained correctly, nor will your settings be included when the user does backups of server information.

void* SWPluginServerStruct::pCustomData
 

This variable is designed to give plugin writers a place to store plugin specific server information.

A plugin writer can set this variable to any structure or class that they wish. By default this variable will be NULL unless set by the plugin on the call to InitServer(). Once this has been done, the structure or class will be pernamently associated to the server and will be in the SWPluginServerStruct on subsequent calls by Server Watch that have the structure passed into it and are asspociated to this server.

 SWRESULT InitServer(SWPluginServerStruct* pThisServer)
 {
     pThisServer->pCustomData = (void*) new MyCustomClass;
 }

 SWRESULT CleanupServer(SWPluginServerStruct* pThisServer)
 {
     delete pThisServer->pCustomData;
     pThisServer->pCustomData = NULL;
 }

 SWRESULT UseCustomData(SWPluginServerStruct* pThisServer)
 {
     MyCustomClass *pMyClass = (MyCustomClass*)pThisServer->pCustomData;
     pMyClass->DoSomething();
 }

If you intend to use the structure or class associated with pCustomData in either the Ping() function or your own threaded functions, this class must be thread safe or otherwise have some thread safety mechanism to protect the data within from corruption caused by thread race conditions.

Note:
Any structure or classes created in InitServer() and set to this variable should be cleaned up in the call to CleanupServer().
See also:
swplugindll.h


The documentation for this struct was generated from the following file:

Copyright (c) 2003-2004, Deep Fried Software. All rights reserved.